//
//  MusicViewCell.m
//  XMLY
//
//  Created by lanou on 15/11/4.
//  Copyright © 2015年 曾杰. All rights reserved.
//

#import "MusicViewCell.h"
#define screen_width  [UIScreen mainScreen].bounds.size.width
#define screen_height [UIScreen mainScreen].bounds.size.height
#import "UIImageView+WebCache.h"
@implementation MusicViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _pictureView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, screen_height/6, screen_height/6)];
        [self.contentView addSubview:_pictureView];
        
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(screen_height/6+20, 15,screen_width-screen_height/6-20, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_titleLabel];
        
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(screen_height/6+20, 50,screen_width-screen_height/6-20, 20)];
        _nameLabel.font = [UIFont systemFontOfSize:15];
        _nameLabel.alpha = 0.6;
        [self.contentView addSubview:_nameLabel];
        
        
        _playCountView = [[UIImageView alloc]initWithFrame:CGRectMake(screen_height/6+20, 85, 20, 20)];
        _playCountView.image = [UIImage imageNamed:@"erji"];
        _playCountView.alpha = 0.6;
        [self.contentView addSubview:_playCountView];
        
        
        _playCountLabel = [[UILabel alloc]initWithFrame:CGRectMake(screen_height/6+15+25, 85, 60, 20)];
        _playCountLabel.alpha = 0.6;
        _playCountLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_playCountLabel];
        
        
        _trackView = [[UIImageView alloc]initWithFrame:CGRectMake(screen_height/6+20+75, 85, 20, 20)];
        _trackView.image = [UIImage imageNamed:@"jishu"];
        _trackView.alpha = 0.6;
        [self.contentView addSubview:_trackView];
        
        
        _trackLabel = [[UILabel alloc]initWithFrame:CGRectMake(screen_height/6+20+100, 85, 40, 20)];
        _trackLabel.font = [UIFont systemFontOfSize:13];
        _trackLabel.alpha = 0.6;
        [self.contentView addSubview:_trackLabel];
        self.contentView.backgroundColor = [UIColor whiteColor];
        
    }
    return self;
}
-(void)configMusicCellWithModel:(MusicModel *)model
{

    [self.pictureView sd_setImageWithURL:[NSURL URLWithString:model.coverMiddle]];
    self.titleLabel.text = model.title;
    self.nameLabel.text = model.intro;
    if (model.playsCounts<10000) {
         self.playCountLabel.text =[NSString stringWithFormat:@"%ld",model.playsCounts];
    }
    else
    {
    self.playCountLabel.text =[NSString stringWithFormat:@"%.1f万",model.playsCounts/10000.0];
    }
    self.trackLabel.text =[NSString stringWithFormat:@"%ld集",model.tracks];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
